package cn.zjj.feignclient;

import cn.zjj.domain.User;
import cn.zjj.fallbackFactory.UserFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@FeignClient(name = "user-server",fallbackFactory = UserFallbackFactory.class)//name:user的应用名字
@RequestMapping("/user")//user的公共路径
public interface UserFeignClient {
    /*
     * @Description: OpenFeign调用user服务接口，默认底层会帮助我们创建动态代理实现类，会使用RestTemplate进行调用
     **/
    @GetMapping("/getById/{id}")
    User getById(@PathVariable("id") Long id);
}
